#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define int long long

void solve()
{
    int n; cin >> n;
    vector<int> arr(n); for (auto& e : arr) cin >> e;
    int x; cin >> x;
    int l = INT_MAX, r = INT_MIN;
    for (auto& e : arr) {
        l = min(l, e);
        r = max(r, e);
    }
    if (x >= l && x <= r) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

signed main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t; cin >> t;
    while (t--) solve();
    return 0;
}